#!/bin/env python2.6
# the prediction algorithm
def predict(last, next):
    # analyze previous data
    try:
        a = prev[last[-1] + ' is']
    except KeyError:
        a = 1
    try:
        b = prev[last[-1] + ' are']
    except KeyError:
        b = 1
    if b / a > 1:
        return 'are'
    # there is/are
    if last[-1] == 'there' and next[-1] == 's':
        return 'are'
    return 'is'

# word generator
def fwords():
    from sys import stdin as si
    while 1:
        data = si.read(10240)
        if data == '':
            break
        while data[-1] != ' ':
            pad = si.read(1)
            if pad == '':
                break
            data += pad
        data = data.split()
        if data[-1] == '':
            data = data[:-1]
        for word in data:
            yield word
    return

words = fwords()

last = [words.next() for x in xrange(5)]
from sys import stdout as so
# calculate exceptions
exc = ''
TODO = 0
prev = {}
while 1:
    try:
        next = words.next()
        if last[-1] in ['is', 'are']:
            if last[-1] == predict(last[:-1], next):
                #print 'OK:', last, predict(last[:-1], next)
                exc += '0'
            else:
                #print 'EXCEPTION:', last, predict(last[:-1], next)
                exc += '1'
                TODO += 1
            try:
                prev[' '.join(last[-2:])] += 1
            except KeyError:
                prev[' '.join(last[-2:])] = 1
        #so.write('is ')
        #else:
            #so.write(last[-1] + ' ')
        del last[0]
        last.append(next)
        next = words.next()
    except StopIteration:
        #so.write(last[-0])
        break

print TODO
print len(exc)

# compress exceptions
from bz2 import compress as c
exc = repr(c(exc)[10:])

# write exceptions
excf = open('partbd.py', 'w')
excf.write('exc = ' + exc)
excf.close()
